// 对api进行统一的管理
import requests from './request'
import requestsMock from './requestMock'
// 三级联动
export const getBaseCategoryList = () => {
  return requests({url: '/product/getBaseCategoryList',method: "GET"})
}
// mockjs模拟数据
export const getBannerList = () => {
  return requestsMock({ url: '/banner',method: "GET"})
}
// 搜索商品
export const reqGetGoodsList = (query) => {
  return requests({url: '/list',method: "POST",data: query})
}
// 获取商品详情
export const reqGetGoodsDetail = (id) => {
  return requests({url: `/item/${id}`,method: "GET"})
}
// 添加到购物车
export const reqAddCar = (id,num) => {
  return requests({url: `/cart/addToCart/${id}/${num}`,method: "POST"})
}
// 获取购物车列表
export const reqShopCartList = () => {
  return requests({url: `/cart/cartList`,method: "GET"})
}
// 购物车删除
export const reqDelectCart = (id) => {
  return requests({url: `/cart/deleteCart/${id}`,method: "DELETE"})
}
// 切换商品选中的状态
export const reqChangeSatuas = (id,isChecked) => {
  return requests({url: `/cart/checkCart/${id}/${isChecked}`,method: "GET"})
}
// 获取验证码
export const reqCodeNum = (phone) => {
  return requests({url: `/user/passport/sendCode/${phone}`,method: "GET"})
}
// 注册用户
export const reqUserLogin = (data) => {
  return requests({url: `/user/passport/register`,data,method: "POST"})
}
// 用户登录
export const reqLogin = (data) => {
  return requests({url: `/user/passport/login`,data,method: "POST"})
}
// 获取用户信息
export const reqGetUserInfo = () => {
  return requests({url: `/user/passport/auth/getUserInfo`,method: "GET"})
} 
// 退出登录
export const reqLoginOut = () => {
  return requests({url: `/user/passport/logout`,method: "GET"})
} 
// 获取用户地址信息
export const reqGetUserAdress = () => {
  return requests({url: `/user/userAddress/auth/findUserAddressList`, method: "GET"})
} 
// 获取商品的清单
export const reqGetShopList = () => {
  return requests({url: `/order/auth/trade`, method: "GET"})
} 
// 提交订单
export const reqPutOrder = (tradeNo,data) => {
  return requests({url: `/order/auth/submitOrder?tradeNo=${tradeNo}`,data, method: "POST"})
} 
// 获取订单信息/order/auth/trade
export const getOrderInfo = (orderId) => {
  return requests({url: `/payment/weixin/createNative/${orderId}`,method: "GET"})
} 
// 查询订单支付状态/payment/weixin/queryPayStatus/{orderId}
export const findOrderStatus = (orderId) => {
  return requests({url: `/payment/weixin/queryPayStatus/${orderId}`,method: "GET"})
}
// 获取我的订单列表
export const getOrderList = (page,limit) => {
  return requests({url: `/order/auth/${page}/${limit}`,method: "GET"})
}